package main

import (
	"broker-server/config"
	"broker-server/server"
	"common-api/logs"
	"log"
	"os"
	"os/signal"
	"syscall"
)

func main() {
	err, listener := server.Start(config.AppConf.ServerConfig.Addr)
	if err != nil {
		log.Fatal(err)
	}
	//这边主线程一直等待
	quite := make(chan os.Signal)
	signal.Notify(quite, syscall.SIGINT, syscall.SIGKILL, syscall.SIGQUIT)
	//阻塞在这边等待系统信号关闭
	<-quite
	listener.Listener.Close()
	logs.Logger.Infoln("broker server quit")
}
